<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <script type = "text/javascript" src="../scripts/validationScript.js"></script>
    </head>
    <body>
        <p>
          <?php
        // put your code here
			$sesUserId = 1;
        ?>
        </p>
        <form name="frm_addAuthor" method="post" action="ref_addingHandler.php" onsubmit="return addAuthorValidation();">
          <table width="75%" border="1" align="center" cellpadding="2" cellspacing="2">
            <tr>
              <td>&nbsp;</td>
              <td><input type="hidden" name="intUserID" id="intUserID" value="<?php echo $sesUserId; ?>"></input></td>
            </tr>
            <tr>
              <td>First Name</td>
              <td><label>
                <input type="text" name="txtAuthorFirstName" id="txtAuthorFirstName" size="50">
              </label></td>
            </tr>
            <tr>
              <td>Middle Name</td>
              <td><label>
                <input name="txtAuthorMiddleName" type="text" id="txtAuthorMiddleName" size="50">
              </label></td>
            </tr>
            <tr>
              <td>Last Name</td>
              <td><label>
                <input name="txtAuthorLastName" type="text" id="txtAuthorLastName" size="50">
              </label></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td><label>
                <input type="submit" name="addAuthor" id="addAuthor" value="Submit">
              </label></td>
            </tr>
          </table>
    </form>
        <hr>
        <?php
			require '..\lib\dbConnection.php';
			
			$authorDataSet = mysql_query("SELECT ID,FirstName, MiddleName, LastName FROM ref_authors WHERE RecordStatus = 'ACTIVE'", $dbConnection);
		?>
                <table align="center" width="50%" border="1">
            <tr>
            	<td>#</td>
                <td>First Name</td>
                <td>Last Name</td>
                <td>Middle Name</td>
            </tr>
                    <?php
						$rowCount = 1;
                        while ($dataRow = mysql_fetch_array($authorDataSet))
                        {
                            ?>
            <form action="" method="post" name="frm_Category">
            <tr>
            				<td><?php echo $rowCount++; ?></td>
                            <td><?php echo $dataRow["FirstName"]; ?></td>
                            <td><?php echo $dataRow["LastName"]; ?></td>
                            <td><?php echo $dataRow["MiddleName"]; ?></td>
                            <td><a href="ref_editAuthor.php?id=<?php echo $dataRow["ID"]; ?>">Edit</a></td>
                        </tr>
                        </form>
                       <?php 
                            }
                        
                        mysql_close($dbConnection);
        ?>
        
        </table>
</body>
</html>
